/**
 * @param {number[]} postorder
 * @return {boolean}
 */
var verifyPostorder = function(postorder) {
    var judge=function(seq){
        console.log(seq);
        if(seq.length==0||seq.length==1) return true;
        let tag=seq[seq.length-1];
        let i=0;
        while(seq[i]<tag){
            i++;
        }
        let j=i+1;
        while(j<seq.length-1){
            if(seq[j]<tag){
                return false;
            }
            j++;
        }
        return judge(seq.slice(0,i))&&(seq.slice(i,seq.length-1));
    };
    return judge(postorder);
};

let a=verifyPostorder([1,2,5,10,6,9,4,3]);
console.log(a);